<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/webjars/layui/2.5.7/css/layui.css"/>
</head>
<script src="/webjars/layui/2.5.7/layui.js"></script>

<body>
<form class="layui-form">
<!--    <input type="text" name="id" th:value="${tea.id}" style="display: none">-->

    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input class="layui-input" type="text" name="id" th:value="${tea.id}" disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="username" th:value="${tea.username}"   placeholder="请输入标题"  class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="text" name="password"  th:value="${tea.password}"    placeholder="请输入标题"  class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="test">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    //Demo
    layui.use(['form','jquery'], function(){
        var form = layui.form;
        var $ = layui.jquery;
        //监听提交
        form.on('submit(test)', function(data){
            layer.msg(JSON.stringify(data.field));
            $.ajax({
                //当你的数据请求格式为json时，请求方式必须为post
                url:'/editTeacher',
                method:'post',
                data:JSON.stringify(data.field),
                dataType:'json',
                contentType:'application/json'
            })


            return false;
        });
    });
</script>
</body>
</html>